In [4]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
from warnings import filterwarnings 
filterwarnings("ignore")
In [5]:
data=pd.read_csv(r"C:\\Users\\laxma\\Downloads\\menu.csv")
data
Out[5]:
Category Item Serving Size Calories Calories from Fat Total Fat Total Fat (% Daily Value) Saturated Fat Saturated Fat (% Daily Value) Trans Fat ... Carbohydrates Carbohydrates (% Daily Value) Dietary Fiber Dietary Fiber (% Daily Value) Sugars Protein Vitamin A (% Daily Value) Vitamin C (% Daily Value) Calcium (% Daily Value) Iron (% Daily Value)
0 Breakfast Egg McMuffin 4.8 oz (136 g) 300 120 13.0 20 5.0 25 0.0 ... 31 10 4 17 3 17 10 0 25 15
1 Breakfast Egg White Delight 4.8 oz (135 g) 250 70 8.0 12 3.0 15 0.0 ... 30 10 4 17 3 18 6 0 25 8
2 Breakfast Sausage McMuffin 3.9 oz (111 g) 370 200 23.0 35 8.0 42 0.0 ... 29 10 4 17 2 14 8 0 25 10
3 Breakfast Sausage McMuffin with Egg 5.7 oz (161 g) 450 250 28.0 43 10.0 52 0.0 ... 30 10 4 17 2 21 15 0 30 15
4 Breakfast Sausage McMuffin with Egg Whites 5.7 oz (161 g) 400 210 23.0 35 8.0 42 0.0 ... 30 10 4 17 2 21 6 0 25 10
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
255 Smoothies & Shakes McFlurry with Oreo Cookies (Small) 10.1 oz (285 g) 510 150 17.0 26 9.0 44 0.5 ... 80 27 1 4 64 12 15 0 40 8
256 Smoothies & Shakes McFlurry with Oreo Cookies (Medium) 13.4 oz (381 g) 690 200 23.0 35 12.0 58 1.0 ... 106 35 1 5 85 15 20 0 50 10
257 Smoothies & Shakes McFlurry with Oreo Cookies (Snack) 6.7 oz (190 g) 340 100 11.0 17 6.0 29 0.0 ... 53 18 1 2 43 8 10 0 25 6
258 Smoothies & Shakes McFlurry with Reese's Peanut Butter Cups (Medium) 14.2 oz (403 g) 810 290 32.0 50 15.0 76 1.0 ... 114 38 2 9 103 21 20 0 60 6
259 Smoothies & Shakes McFlurry with Reese's Peanut Butter Cups (Snack) 7.1 oz (202 g) 410 150 16.0 25 8.0 38 0.0 ... 57 19 1 5 51 10 10 0 30 4

260 rows × 24 columns

In [6]:
data.head()
Out[6]:
Category Item Serving Size Calories Calories from Fat Total Fat Total Fat (% Daily Value) Saturated Fat Saturated Fat (% Daily Value) Trans Fat ... Carbohydrates Carbohydrates (% Daily Value) Dietary Fiber Dietary Fiber (% Daily Value) Sugars Protein Vitamin A (% Daily Value) Vitamin C (% Daily Value) Calcium (% Daily Value) Iron (% Daily Value)
0 Breakfast Egg McMuffin 4.8 oz (136 g) 300 120 13.0 20 5.0 25 0.0 ... 31 10 4 17 3 17 10 0 25 15
1 Breakfast Egg White Delight 4.8 oz (135 g) 250 70 8.0 12 3.0 15 0.0 ... 30 10 4 17 3 18 6 0 25 8
2 Breakfast Sausage McMuffin 3.9 oz (111 g) 370 200 23.0 35 8.0 42 0.0 ... 29 10 4 17 2 14 8 0 25 10
3 Breakfast Sausage McMuffin with Egg 5.7 oz (161 g) 450 250 28.0 43 10.0 52 0.0 ... 30 10 4 17 2 21 15 0 30 15
4 Breakfast Sausage McMuffin with Egg Whites 5.7 oz (161 g) 400 210 23.0 35 8.0 42 0.0 ... 30 10 4 17 2 21 6 0 25 10

5 rows × 24 columns

In [7]:
data.tail()
Out[7]:
Category Item Serving Size Calories Calories from Fat Total Fat Total Fat (% Daily Value) Saturated Fat Saturated Fat (% Daily Value) Trans Fat ... Carbohydrates Carbohydrates (% Daily Value) Dietary Fiber Dietary Fiber (% Daily Value) Sugars Protein Vitamin A (% Daily Value) Vitamin C (% Daily Value) Calcium (% Daily Value) Iron (% Daily Value)
255 Smoothies & Shakes McFlurry with Oreo Cookies (Small) 10.1 oz (285 g) 510 150 17.0 26 9.0 44 0.5 ... 80 27 1 4 64 12 15 0 40 8
256 Smoothies & Shakes McFlurry with Oreo Cookies (Medium) 13.4 oz (381 g) 690 200 23.0 35 12.0 58 1.0 ... 106 35 1 5 85 15 20 0 50 10
257 Smoothies & Shakes McFlurry with Oreo Cookies (Snack) 6.7 oz (190 g) 340 100 11.0 17 6.0 29 0.0 ... 53 18 1 2 43 8 10 0 25 6
258 Smoothies & Shakes McFlurry with Reese's Peanut Butter Cups (Medium) 14.2 oz (403 g) 810 290 32.0 50 15.0 76 1.0 ... 114 38 2 9 103 21 20 0 60 6
259 Smoothies & Shakes McFlurry with Reese's Peanut Butter Cups (Snack) 7.1 oz (202 g) 410 150 16.0 25 8.0 38 0.0 ... 57 19 1 5 51 10 10 0 30 4

5 rows × 24 columns

In [8]:
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 260 entries, 0 to 259
Data columns (total 24 columns):
 #   Column                         Non-Null Count  Dtype  
---  ------                         --------------  -----  
 0   Category                       260 non-null    object 
 1   Item                           260 non-null    object 
 2   Serving Size                   260 non-null    object 
 3   Calories                       260 non-null    int64  
 4   Calories from Fat              260 non-null    int64  
 5   Total Fat                      260 non-null    float64
 6   Total Fat (% Daily Value)      260 non-null    int64  
 7   Saturated Fat                  260 non-null    float64
 8   Saturated Fat (% Daily Value)  260 non-null    int64  
 9   Trans Fat                      260 non-null    float64
 10  Cholesterol                    260 non-null    int64  
 11  Cholesterol (% Daily Value)    260 non-null    int64  
 12  Sodium                         260 non-null    int64  
 13  Sodium (% Daily Value)         260 non-null    int64  
 14  Carbohydrates                  260 non-null    int64  
 15  Carbohydrates (% Daily Value)  260 non-null    int64  
 16  Dietary Fiber                  260 non-null    int64  
 17  Dietary Fiber (% Daily Value)  260 non-null    int64  
 18  Sugars                         260 non-null    int64  
 19  Protein                        260 non-null    int64  
 20  Vitamin A (% Daily Value)      260 non-null    int64  
 21  Vitamin C (% Daily Value)      260 non-null    int64  
 22  Calcium (% Daily Value)        260 non-null    int64  
 23  Iron (% Daily Value)           260 non-null    int64  
dtypes: float64(3), int64(18), object(3)
memory usage: 48.9+ KB
In [9]:
data.shape
Out[9]:
(260, 24)
In [10]:
data.index
Out[10]:
RangeIndex(start=0, stop=260, step=1)
In [11]:
data.isnull()
Out[11]:
Category Item Serving Size Calories Calories from Fat Total Fat Total Fat (% Daily Value) Saturated Fat Saturated Fat (% Daily Value) Trans Fat ... Carbohydrates Carbohydrates (% Daily Value) Dietary Fiber Dietary Fiber (% Daily Value) Sugars Protein Vitamin A (% Daily Value) Vitamin C (% Daily Value) Calcium (% Daily Value) Iron (% Daily Value)
0 False False False False False False False False False False ... False False False False False False False False False False
1 False False False False False False False False False False ... False False False False False False False False False False
2 False False False False False False False False False False ... False False False False False False False False False False
3 False False False False False False False False False False ... False False False False False False False False False False
4 False False False False False False False False False False ... False False False False False False False False False False
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
255 False False False False False False False False False False ... False False False False False False False False False False
256 False False False False False False False False False False ... False False False False False False False False False False
257 False False False False False False False False False False ... False False False False False False False False False False
258 False False False False False False False False False False ... False False False False False False False False False False
259 False False False False False False False False False False ... False False False False False False False False False False

260 rows × 24 columns

In [12]:
data.isnull().sum()
Out[12]:
Category                         0
Item                             0
Serving Size                     0
Calories                         0
Calories from Fat                0
Total Fat                        0
Total Fat (% Daily Value)        0
Saturated Fat                    0
Saturated Fat (% Daily Value)    0
Trans Fat                        0
Cholesterol                      0
Cholesterol (% Daily Value)      0
Sodium                           0
Sodium (% Daily Value)           0
Carbohydrates                    0
Carbohydrates (% Daily Value)    0
Dietary Fiber                    0
Dietary Fiber (% Daily Value)    0
Sugars                           0
Protein                          0
Vitamin A (% Daily Value)        0
Vitamin C (% Daily Value)        0
Calcium (% Daily Value)          0
Iron (% Daily Value)             0
dtype: int64
In [13]:
data.duplicated().sum()
Out[13]:
0
In [7]:
data.columns
Out[7]:
Index(['Category', 'Item', 'Serving Size', 'Calories', 'Calories from Fat',
       'Total Fat', 'Total Fat (% Daily Value)', 'Saturated Fat',
       'Saturated Fat (% Daily Value)', 'Trans Fat', 'Cholesterol',
       'Cholesterol (% Daily Value)', 'Sodium', 'Sodium (% Daily Value)',
       'Carbohydrates', 'Carbohydrates (% Daily Value)', 'Dietary Fiber',
       'Dietary Fiber (% Daily Value)', 'Sugars', 'Protein',
       'Vitamin A (% Daily Value)', 'Vitamin C (% Daily Value)',
       'Calcium (% Daily Value)', 'Iron (% Daily Value)'],
      dtype='object')
In [15]:
import matplotlib.pyplot as plt
x=[1,2,3,4,6,12]
y=[7,13,20,24,28,10]
plt.plot(x,y,color="black")
plt.xticks(rotation=45)
Out[15]:
(array([ 0.,  2.,  4.,  6.,  8., 10., 12., 14.]),
 [Text(0, 0, ''),
  Text(0, 0, ''),
  Text(0, 0, ''),
  Text(0, 0, ''),
  Text(0, 0, ''),
  Text(0, 0, ''),
  Text(0, 0, ''),
  Text(0, 0, '')])
In [16]:
plt.plot(data['Category'],data['Sugars'])
plt.xticks(rotation=90)
plt.show()
In [17]:
plt.bar(data['Carbohydrates (% Daily Value)'],data['Protein'])
plt.show()
In [18]:
plt.bar(data['Dietary Fiber'],data['Total Fat (% Daily Value)'])
plt.bar(data['Carbohydrates (% Daily Value)'],data['Protein'])
plt.show()
In [19]:
plt.scatter(data['Iron (% Daily Value)'],data['Dietary Fiber'])
plt.show()
In [20]:
plt.scatter(data['Dietary Fiber'],data['Saturated Fat'])
plt.plot(data['Category'],data['Sugars'])
plt.xticks(rotation=90)
plt.show()
In [21]:
plt.bar(data['Category'],data['Calories from Fat'],color=['red','grey','red','blue','black','green','red','grey','red','blue'])
plt.xticks(rotation=90)
plt.show()
In [22]:
sns.barplot(data['Category'],data['Protein'],color='r')
plt.xticks(rotation=90)
plt.show()
In [23]:
sns.scatterplot(['Calories'],['Protein'],['Serving Size'],['Iron (% Daily Value)'],color='black')
plt.show()
In [24]:
sns.pairplot(data)
Out[24]:
<seaborn.axisgrid.PairGrid at 0x1f65a8df460>
In [25]:
sns.displot(data["Protein"])
Out[25]:
<seaborn.axisgrid.FacetGrid at 0x1f66d844fa0>
In [26]:
sns.heatmap(data.corr())
Out[26]:
<AxesSubplot:>
In [27]:
sns.relplot(x='Calories from Fat',y='Dietary Fiber (% Daily Value)',data=data)
Out[27]:
<seaborn.axisgrid.FacetGrid at 0x1f6720a9ca0>
In [28]:
sns.violinplot(x='Vitamin A (% Daily Value)',y='Calories',data=data)
Out[28]:
<AxesSubplot:xlabel='Vitamin A (% Daily Value)', ylabel='Calories'>
In [29]:
sns.countplot(x='Dietary Fiber (% Daily Value)',data=data)
Out[29]:
<AxesSubplot:xlabel='Dietary Fiber (% Daily Value)', ylabel='count'>
In [30]:
sns.boxplot(x='Vitamin C (% Daily Value)',y='Carbohydrates',data=data)
Out[30]:
<AxesSubplot:xlabel='Vitamin C (% Daily Value)', ylabel='Carbohydrates'>
In [31]:
sns.lineplot(x='Saturated Fat (% Daily Value)',y='Sugars',data=data)
Out[31]:
<AxesSubplot:xlabel='Saturated Fat (% Daily Value)', ylabel='Sugars'>
In [45]:
data.to_csv('mc donalds.csv')
In [ ]:
 
In [ ]:
 
In [ ]: